import api from './index'

interface Exam {
  id?: number
  name: string
  exam_id: string
  exam_time: string
  student_count: number
  supervisor_count: number
}

export const examApi = {
  getExams: (): Promise<Exam[]> => {
    return api.get('/exams')
  },

  createExam: (exam: Omit<Exam, 'id' | 'supervisor_count'>): Promise<any> => {
    return api.post('/exams', exam)
  },

  updateExam: (id: number, exam: Omit<Exam, 'id' | 'supervisor_count'>): Promise<any> => {
    return api.put(`/exams/${id}`, exam)
  },

  deleteExam: (id: number): Promise<any> => {
    return api.delete(`/exams/${id}`)
  }
}
